#include <stdio.h>

int main(void)
{
	int n, sum = 0;

	printf("Input a positive integer: ");
	scanf("%d", &n);
	while (n)
	{
		sum += n % 10;
		n /= 10;
	}
	printf("sum = %d\n", sum);

	return 0;
}